//详情页相关
let detail_vm = new Vue({
    el:".detail_div",
    data:{
        works:{
            title:"原创风格",
            author:"葱油猫饼",
            likeCount:23,
            imgurl:"images/works/m2.webp",
            iconurl:"images/artist.png"
        },
        user:{
            introl:"这个人是职业画师...",
            fans:"999999"
        }
        ,isLogin:false
    },
    created:function () {
        // //检查登录请求
        // axios.get("/checklogin").then(function (response) {
        //     detail_vm.isLogin=response.data;
        // }).catch(function (err) {
        //     alert(err);
        // })
        //查询作品详情请求   ?id=3
        let id = location.search.split("=")[1];
        axios.get("/select?id="+id).then(function (response) {
            detail_vm.works = response.data;
        }).catch(function (err) {
            alert(err);
        })
        //查询作者详情请求
        let authorName = location.search.split("=")[1];
        axios.get("/selectAuthor?name="+author).then(function (response) {
            detail_vm.works = response.data;
        }).catch(function (err) {
            alert(err);
        })
    },
    methods:{
        backHome:function(){
            location.href="home.html"
        },
        likeById:function (id) {
            axios.get("/like?id="+id).then(function (response) {
                detail_vm.works = response.data;
            }).catch(function (err) {
                alert(err);
            })
        }
    }
})